<%@ page language="java"  contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
	<style>
		table thead tr th {
    		background-color: #DDD;
    		color: #666;
		}
		.controls input{
			width:100% !important;
		}
	</style>
</head>
<body class="fixed-top">
      
         <div class="container-fluid">
            <!-- BEGIN PAGE HEADER-->   
            <div class="row-fluid">
               <div class="span12">
                   <h3 class="page-title">
                     用户查询
                   </h3>
                   <ul class="breadcrumb">
                       <li>
                           <a href="#">首页</a>
                           <span class="divider">/</span>
                       </li>
                       <li>
                           <a href="#">用户管理</a>
                           <span class="divider">/</span>
                       </li>
                       <li class="active">
                           用户查询
                       </li>
                       
                   </ul>
                   <!-- END PAGE TITLE & BREADCRUMB-->
               </div>
            </div>
            <!-- END PAGE HEADER-->
            <!-- BEGIN PAGE CONTENT-->

            <div id="page-wraper">
            	<div class="row-fluid">
            	 	<form action="#" class="form-vertical" 
                             					novalidate="novalidate" id="signupForm1">
				                                 <div class="control-group span2">
				                                     <label class="control-label" for="applyUser">用户账号</label>
				                                     <div class="controls">
				                                         <input type="text" class="span6" name="applyUser" id="applyUser" />
				                                     </div>
				                                 </div>
				
				                                 <div class="control-group span2">
				                                     <label class="control-label" for="idNumber">用户姓名</label>
				                                     <div class="controls">
				                                         <input type="text" class="span6" id="idNumber" name="idNumber" />
				                                     </div>
				                                 </div>
				
				                                 <!-- <div class="control-group span2">
				                                     <label class="control-label" for="plateNo">手机号</label>
				                                     <div class="controls">
				                                         <input type="text" class="span6" id="plateNo" name="plateNo" />
				                                     </div>
				                                 </div> -->
				                                  <div class="control-group span2">
				                                     <button type="submit"  style="margin-top: 27px;width: 90px;" class="btn btn-success" onclick="queryCar()">查询</button>
				                                 </div> 
			    
			                             	</form>
			    </div>      
                <div class="row-fluid">
                    <div class="span12">
                          <table class="table table-striped table-bordered dataTable  table-hover">
                                    <thead>
                                    <tr>
                                        <th>用户账号</th>
                                        <th>用户姓名</th>
                                        <th>联系电话</th>
                                        <th></th>
                                    </tr>
                                    </thead>
                                    <tbody id="tableBody">                                   
                                    </tbody>
                          </table>
                    </div>
                </div> 
                <div class="row-fluid">
                	<div class="span6">
                		<div class="dataTables_info" id="sample_1_info">当前显示<span id="pageSize"></span>条，共<span id="totalSize"></span>条</div>
                	</div>
                	<div class="span6">
                		<div class="dataTables_paginate paging_bootstrap pagination">
                		<ul><li class="prev disabled">
                			<a href="#">← 上一页</a></li>
                			<li class="active"><a href="#">1</a></li><li><a href="#">2</a></li><li><a href="#">3</a></li>
                			<li class="next"><a href="#">下一页 → </a></li></ul></div>
                	</div>
               	</div>
            </div>
         </div>
         
         <!--  删除对话框  -->
         <div id="deleteModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3" aria-hidden="true" style="display: none;">
                   <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                         <h3 id="myModalLabel3">删除</h3>
                   </div>    
                   <div class="modal-body">
                          <p>确定要删除此用户吗？</p>
                   </div>
                   <div class="modal-footer">
                          <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
                          <button data-dismiss="modal" class="btn btn-primary" onclick="doDelete()">确定</button>
                   </div>
         </div>
         
         <script>
         	$(document).ready(function(){
         		$('#roleMenu').addClass("open");
    	    	$('#roleMenu').find(".sub").show();
    	    	$('#item_roleList').addClass("active");
         		var list = dbTool.getUserList();
       			for(var i=0;i<list.length;i++){
       				var apply = list[i];
         			
         			html = '<tr id="tr'+apply.id+'">';
         			html+=('<td>'+apply.loginName+'</td>');
         			html+=('<td>'+apply.userName+'</td>');          
         			html+=('<td>'+apply.cellphone+'</td>');             		
             		html+=('<td>');
             		//html+=('<button class="btn btn-success"><i class="icon-ok"></i></button>');
             		//html+=('<button class="btn btn-primary"><i class="icon-pencil"></i></button>');
             		html+=('<a href="#deleteModal" onclick="deleteItem(\''+apply.id+'\')" role="button" class="btn btn-warning" data-toggle="modal">删除</a>');
             		html+=('</td>');             		
             		html+=('</tr>');
             		
             		$('#tableBody').append(html);
        		}
       			
       			$('#pageSize').text(list.length);
       			$('#totalSize').text(list.length);
       			
         	});
         	
         	function doDelete(){
         		dbTool.deleteUser(itemId);
     			$('#tr'+itemId).remove();
         	}
         	var itemId = null;
         	function deleteItem(id){
         		itemId = id;
         	}
         </script>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
 

<t:datagrid name="userList" title="common.operation" actionUrl="userController.do?datagrid" 
    fit="true" fitColumns="true" idField="id" queryMode="group" sortName="createDate" sortOrder="desc">
	<t:dgCol title="common.id" field="id" hidden="true"></t:dgCol>
	<t:dgCol title="common.username" sortable="false" field="userName" query="true"  width="120"></t:dgCol> 
	<t:dgCol title="common.department" sortable="false" field="userOrgList.tsDepart.departname" query="true"  width="120"></t:dgCol>
 	<t:dgCol title="common.real.name" field="realName" query="true" width="120"></t:dgCol>
	<t:dgCol title="common.role" field="userKey"  width="120"></t:dgCol>
	<t:dgCol title="common.createby" field="createBy" hidden="true"></t:dgCol>
	<t:dgCol title="common.createtime" field="createDate" formatter="yyyy-MM-dd" hidden="true"></t:dgCol>
	<t:dgCol title="common.updateby" field="updateBy" hidden="true"></t:dgCol>
	<t:dgCol title="common.updatetime" field="updateDate" formatter="yyyy-MM-dd" hidden="true"></t:dgCol>
	<t:dgCol title="common.status" sortable="true" field="status" replace="common.active_1,common.inactive_0,super.admin_-1"
		  width="120"></t:dgCol>
	<t:dgCol title="common.operation" field="opt"  width="120"></t:dgCol>
	<t:dgToolBar title="common.add.param" langArg="common.user" icon="icon-add" url="userController.do?addorupdate" funname="add" width="590" height="380"></t:dgToolBar> 
	<t:dgFunOpt  funname="editItemDetail({'编辑'},{'userController.do?addorupdate'},id,{'590'},{'380'})" title="编辑"  />
 	<t:dgDelOpt title="common.delete" url="userController.do?del&id={id}&userName={userName}" />
 	<t:dgToolBar title="common.password.reset" icon="icon-edit" url="userController.do?changepasswordforuser" funname="update" width="500" height="380"></t:dgToolBar>
	<t:dgToolBar title="common.lock.user" icon="icon-edit" url="userController.do?lock&lockvalue=0" funname="lockObj"></t:dgToolBar>
	<t:dgToolBar title="common.unlock.user" icon="icon-edit" url="userController.do?lock&lockvalue=1" funname="unlockObj"></t:dgToolBar>
	
 </t:datagrid>

<script type="text/javascript">

function lockObj(title,url, id) {

	gridname=id;
	var rowsData = $('#'+id).datagrid('getSelections');
	if (!rowsData || rowsData.length==0) {
		tip('<t:mutiLang langKey="common.please.select.edit.item"/>');
		return;
	}
		url += '&id='+rowsData[0].id;

	$.dialog.confirm('<t:mutiLang langKey="common.lock.user.tips"/>', function(){
		lockuploadify(url, '&id');
	}, function(){
	});
}
function unlockObj(title,url, id) {

	gridname=id;
	var rowsData = $('#'+id).datagrid('getSelections');
	if (!rowsData || rowsData.length==0) {
		tip('<t:mutiLang langKey="common.please.select.edit.item"/>');
		return;
	}
		url += '&id='+rowsData[0].id;

	$.dialog.confirm('<t:mutiLang langKey="common.unlock.user.tips"/>', function(){
		lockuploadify(url, '&id');
	}, function(){
	});
}


function lockuploadify(url, id) {
	$.ajax({
		async : false,
		cache : false,
		type : 'POST',
		url : url,// 请求的action路径
		error : function() {// 请求失败处理函数
		},
		success : function(data) {
			var d = $.parseJSON(data);
			if (d.success) {
			var msg = d.msg;
				tip(msg);
				reloadTable();
			}
			
		}
	});
}
</script>

<%--update-start--Author:zhangguoming  Date:20140827 for：添加 组织机构查询条件：弹出 选择组织机构列表 相关操作--%>
<%--<a href="#" class="easyui-linkbutton" plain="true" icon="icon-search" onClick="choose_297e201048183a730148183ad85c0001()">选择</a>--%>
<%--<a href="#" class="easyui-linkbutton" plain="true" icon="icon-redo" onClick="clearAll_297e201048183a730148183ad85c0001();">清空</a>--%>
<script type="text/javascript">
//    var windowapi = frameElement.api, W = windowapi.opener;
    function choose_297e201048183a730148183ad85c0001() {
        if (typeof(windowapi) == 'undefined') {
            $.dialog({content: 'url:departController.do?departSelect', zIndex: 2100, title: '<t:mutiLang langKey="common.department.list"/>', lock: true, width: 400, height: 350, opacity: 0.4, button: [
                {name: '<t:mutiLang langKey="common.confirm"/>', callback: clickcallback_297e201048183a730148183ad85c0001, focus: true},
                {name: '<t:mutiLang langKey="common.cancel"/>', callback: function () {
                }}
            ]});
        } else {
            $.dialog({content: 'url:departController.do?departSelect', zIndex: 2100, title: '<t:mutiLang langKey="common.department.list"/>', lock: true, parent: windowapi, width: 400, height: 350, left: '85%', top: '65%', opacity: 0.4, button: [
                {name: '<t:mutiLang langKey="common.confirm"/>', callback: clickcallback_297e201048183a730148183ad85c0001, focus: true},
                {name: '<t:mutiLang langKey="common.cancel"/>', callback: function () {
                }}
            ]});
        }
    }
    function clearAll_297e201048183a730148183ad85c0001() {
        if ($('#departname').length >= 1) {
            $('#departname').val('');
            $('#departname').blur();
        }
        if ($("input[name='departname']").length >= 1) {
            $("input[name='departname']").val('');
            $("input[name='departname']").blur();
        }
        $('#orgIds').val("");
    }
    function clickcallback_297e201048183a730148183ad85c0001() {
        iframe = this.iframe.contentWindow;
        var departname = iframe.getdepartListSelections('text');
        if ($('#departname').length >= 1) {
            $('#departname').val(departname);
            $('#departname').blur();
        }
        if ($("input[name='departname']").length >= 1) {
            $("input[name='departname']").val(departname);
            $("input[name='departname']").blur();
        }
        var id = iframe.getdepartListSelections('id');
        if (id !== undefined && id != "") {
            $('#orgIds').val(id);
            $("input[name='orgIds']").val(id);
        }
    }

	//导入
	function ImportXls() {
		openuploadwin('Excel导入', 'userController.do?upload', "userList");
	}

	//导出
	function ExportXls() {
		JeecgExcelExport("userController.do?exportXls", "userList");
	}

	//模板下载
	function ExportXlsByT() {
		JeecgExcelExport("userController.do?exportXlsByT", "userList");
	}
</script>
<%--update-end--Author:zhangguoming  Date:20140827 for：添加 组织机构查询条件：弹出 选择组织机构列表 相关操作--%>
